﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using SRP_LibBusinessEntity;
using SRP_LibBusinessRules;
using System.Data;


namespace SRPCENTRIA.ws_appPrivada
{
    public partial class msContenido : System.Web.UI.MasterPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            ValidarSessiones();
            lista();
        }

        #region "Custom Methods"

        private void ValidarSessiones()
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("../wsLogin.aspx");
            }
        }

        private void lista()
        {
            foreach (Control frmctrl in ContentPlaceHolder1.Controls)
            {
                if (frmctrl is System.Web.UI.HtmlControls.HtmlForm)
                {
                    foreach (Control contentControl2 in frmctrl.Controls)
                    {
                        if (contentControl2 is System.Web.UI.UpdatePanel)
                        {
                            foreach (Control contentControl3 in contentControl2.Controls)
                            {
                                if (contentControl3 is System.Web.UI.Control)
                                {
                                    foreach (Control contentControl4 in contentControl3.Controls)
                                    {
                                        if (contentControl4.GetType().ToString().Equals("System.Web.UI.WebControls.GridView"))
                                        {
                                            if (contentControl4.ID == ("GvgRubro") || contentControl4.ID == ("gvKeyWord"))
                                            {
                                                return;
                                            }
                                            else
                                            {
                                                DataTable dt = new DataTable();
                                                NParametria parametria = new NParametria();
                                                dt = parametria.ListarParametria();
                                                string Cant = dt.Rows[0].ItemArray[dt.Columns["IPARA_CANT_GRIA"].Ordinal].ToString();

                                                GridView grid = (GridView)(contentControl4);
                                                grid.PageSize = Convert.ToInt16(Cant);
                                                grid.AllowPaging = true;
                                                grid.DataBind();
                                            }
                                          

                                        }
                                    }
                                }
                               
                            }
                        }
                    }
                }



            }

        #endregion


        }

        protected void lbterminarsession_Click(object sender, EventArgs e)
        {
            Session.Abandon();
        }
    }
}